import axios from 'axios';
import qs from 'query-string';

export interface InstructorRecord {
  id: string;
  number: number;
  name: string;
  phoneNumber: number;
  entryTime: string;
}

export interface InstructorParams extends Partial<InstructorRecord> {
  current: number;
  pageSize: number;
}

export interface InstructorListRes {
  list: InstructorRecord[];
  total: number;
}

export function queryInstructorList(params: InstructorParams) {
  return axios.get<InstructorListRes>('/api/list/instructors', {
    params,
    paramsSerializer: (obj) => {
      return qs.stringify(obj);
    },
  });
}
